<div class="main-content">
	<header>
    <a href="<?php echo bu('admin/programs/edit/'.$_GET['id']); ?>" class="fr button button-gray">Edit Info</a>
		<h2>Member Program - <?php echo $program->long_name; ?></h2>
  </header>

	<section>
    <fieldset>
      <legend>
        <?php if($program->name ='Activities'){ echo 'Additional Information';  ?>
        <?php }else{ echo 'User Information'; } ?>
      </legend>

      <table class="custom full">
        <?php
          $arr_length = count($fields);
          $a = 0;
          foreach($model->attributes as $m){
        ?>
        <tr>
          <th><label><?php echo str_replace('_',' ',ucwords($fields[$a])); ?></label></th>
          <td>
            <?php 
              if(ucwords($fields[$a]) == 'Photo' && $m){
                echo '<img src="'.bu('assets/users/'.$model_name.'/'.$m).'" style="width:100px" />';
              }else{
                echo $m;
              }
            ?>
          </td>
        </tr>
        <?php
          $a++; }
        ?>
      </table>
    </fieldset>
    
    <?php 
      if($details){
        if($program->name ='Activities'){ 
          foreach($details as $detail){
            $detail_fields = array_keys($detail->attributes);
            $attributes = $detail->attributes;
            $detail_attributes = Array();
            
            // set attribute name into array
            foreach($attributes as $attr){
              array_push($detail_attributes, $attr);
            }
    ?>
          <fieldset>
            <legend><?php echo $detail->name.' - '.$detail->position; ?></legend>
            
            <table class="custom full">
              <?php 
                $max = 0;
                if($detail->position == 'Student'){ $max = 9; }else{ $max = 7; }
                for($b = 0; $b<$max; $b++){
                  if($b!=1){
              ?>
              <tr>
                <th><label><?php echo str_replace('_',' ',ucwords($detail_fields[$b])); ?></label></th>
                <td><?php echo $detail_attributes[$b]; ?></td>
              </tr>
              <?php }} ?>
            </table>
          </fieldset>
    <?php }}} ?>
	</section>
</div>